﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel.Composition;
using Core.BusinessLogic.Interfaces;
using Core.DataAccess.IRepositories;
using Core.DataAccess;
using Core.Common;

namespace Core.BusinessLogic
{
    [Export(typeof(IFileService))]
    public class FileService : IFileService
    {
        [Import]
        private IFileRepository _fileRepository;

        public FileService()
        {
            MEFManager.Compose(this);
        }

        public long SaveFile(File file)
        {
            return _fileRepository.SaveFile(file);
        }


        public List<File> GetFilesByFolderID(List<Guid> folderIds)
        {
            return _fileRepository.GetFilesByFolderID(folderIds);
        }

        public File GetFileByFileID(long FileID)
        {
            return _fileRepository.GetFileByFileID(FileID);
        }


        public File GetFileByAccountID(int accountID)
        {
            return _fileRepository.GetFileByAccountID(accountID);
        }


        public File GetFileImgCoverByAccountID(int accountID)
        {
            return _fileRepository.GetFileByAccountID(accountID);
        }


        public void UpdateIsPublicResourceByFileName(string fileName)
        {
            _fileRepository.UpdateIsPublicResourceByFileName(fileName);
        }
    }
}
